﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MagnOS.Drivers
{
    class SoundBlaster16
    {
        //Based off of the Sound Blaster 16, driver by: Civilwarrock

        /*
         * Docs: http://www.inversereality.org/tutorials/sound%20programming/examples/soundblaster16example2.html & http://homepages.cae.wisc.edu/~brodskye/sb16doc/sb16doc.html
         * This is experminetal and may not work right away.
         */

        /*
         * Port table:
         *                                                    |-Bit-Numbers-|
         * Index	 7	         6	          5	           4	         3	          2	              1	           0
         * 0x00	                                              |Reset Mixer
         * 0x04	     |Voice Volume (L)	                                 |Voice Volume (R)
         * 0x0A		                                                                  |Mic Volume
         * 0x22	     |Master Volume (L)	                                 |Master Volume (R)
         * 0x26	     |MIDI Volume (L)	                                 |MIDI Volume (R)
         * 0x28	     |CD Volume (L)	                                     |CD Volume (R)
         * 0x2E	     |Line Volume (L)	                                 |Line Volume (R)
         * 0x30	     |Master Volume (L)
         * 0x31	     |Master Volume (R)
         * 0x32	     |Voice Volume (L)
         * 0x33	     |Voice Volume (R)
         * 0x34	     |MIDI Volume (L)
         * 0x35	     |MIDI Volume (R)
         * 0x36	     |CD Volume (L)
         * 0x37	     |CD Volume (R)
         * 0x38	     |Line Volume (L)
         * 0x39	     |Line Volume (R)
         * 0x3A	     |Mic Volume
         * 0x3B	     |PC Speaker Volume
         * 0x3F	     |Input Gain (L)
         * 0x40	     |Input Gain (R)
         * 0x41	     |Output Gain (L)
         * 0x42	     |Output Gain (R)
         * 0x43                                                                                                     |AGC
         * 0x44	     |Treble (L)
         * 0x45	     |Treble (R)
         * 0x46	     |Bass (L)
         * 0x47	     |Bass (R)
         */

        /*
         * Todo add all the needed ports, theres alot but it needs to be done.
         */
        public Cosmos.Core.IOPort ResetPort = new Cosmos.Core.IOPort(0x00);
        public Cosmos.Core.IOPort MaVOL_L = new Cosmos.Core.IOPort(0x30);
        public Cosmos.Core.IOPort MaVOL_R = new Cosmos.Core.IOPort(0x31);

        public void SetVolume(byte VolL, byte VolR)
        {
            MaVOL_L.Byte = VolL;
            MaVOL_R.Byte = VolR;
        }

        /* TO BE IMPLEMENTED */
    }
}
